import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: Text('demo'),
          ),
          body: Home3Content(),
        ),
        theme: ThemeData(primarySwatch: Colors.yellow));
  }
}

// 自制椭圆结构
class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 400,
      height: 400,
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(200),
        image: DecorationImage(
            image: NetworkImage(
                "https://scpic.chinaz.net/files/pic/pic9/202111/hpic4699.jpg"),
            fit: BoxFit.cover),
      ),
    );
  }
}

// 椭圆组件
class Home2Content extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: ClipOval(
        child: Image.network(
          "https://scpic.chinaz.net/files/pic/pic9/202111/hpic4699.jpg",
          height: 100,
          width: 100,
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

// 本地图片引入
class Home3Content extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        child: Image.asset(
          "lib/images/image.png",
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}
